<?
    include "../../php/common.php";
    $perPage = 4 ;
    $pageSt = ( $_POST['page'] - 1 ) * $perPage;
    $sql = "SELECT * FROM product ORDER BY id ASC limit {$pageSt},{$perPage}";
    $res = mysqli_query($link,$sql);
    $arr = [] ;
    while( $one = mysqli_fetch_assoc($res) ){
        $arr[] = $one ; 
    }
    echo json_encode( $arr );
?>